Skip to content

fix(logging): route computeGlobalCache slow warn through log interceptor - #115

Merged
justin-carper merged 1 commit into
mainfrom
fix/slow-cache-warn-passthrough
Aug 28, 2026
Merged

fix(logging): route computeGlobalCache slow warn through log interceptor#115
justin-carper merged 1 commit into
mainfrom
fix/slow-cache-warn-passthrough

Conversation

@justin-carper

Copy link
Copy Markdown
Collaborator

The Cursor SDK console.warns a slow global-cache rebuild diagnostic, which leaked raw into the TUI:

113:26:23.106 WARN computeGlobalCache: slow ctx-LocalRequestContextExecutor. rebuildGlobalCache/LocalRequestContextExecutor.computeGlobalCache meta=/totalMs: 1312, cloudRule: 0, codebaseRef: 0, subagents: 416, cursorRules: 1311, ruleCount: 701

Extends the existing console.warn interceptor (same pattern as #111) in both transports:

  • src/provider/cursor-log-intercept.ts (in-process): new SLOW_CACHE_WARN_RE + parseSlowCacheWarnLine, routed via pluginLog with parsed numeric meta
  • src/sidecar/agent-host.mjs (sidecar child): identical regex, forwarded as structured ev:"log" over JSONL

Notes:

  • The leading timestamp token varies in width (13:04:05.123 vs 113:26:23.106), so the pattern accepts 2-3 digit hours
  • The / after meta= is how the SDK prints its empty context object; the parser tolerates it

Tests: new in-process case (recognized line routed with meta, unrelated warn still passes through), new emitSlowCacheWarn fake-SDK hook, sidecar end-to-end assertion. npm run typecheck clean, npm test 622/622.

The Cursor SDK console.warns a slow global-cache rebuild diagnostic
(computeGlobalCache: slow ctx-..., meta=/totalMs: ...), which leaked raw
into the TUI. Extend the existing console.warn interceptor in both the
in-process transport and the sidecar child to recognize it and forward it
as a structured opencode log with parsed numeric meta. The timestamp token
varies in width, so the pattern accepts 2-3 digit hours.
@justin-carper
justin-carper merged commit 5dff36b into main Aug 28, 2026
8 checks passed
@justin-carper
justin-carper deleted the fix/slow-cache-warn-passthrough branch August 28, 2026 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant